package lzyc.pointsManagement.web.controller.business;


import lzyc.pointsManagement.business.course.dto.CourseInfoDto;
import lzyc.pointsManagement.business.service.CourseInfoService;
import lzyc.pointsManagement.common.core.page.PageDomain;
import lzyc.pointsManagement.common.response.ResponseMessage;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/api/v1/study")
@RestController
public class StudyGardenController {

    CourseInfoService courseInfoService;

    StudyGardenController(CourseInfoService courseInfoService) {
        this.courseInfoService = courseInfoService;
    }

    @PostMapping("/list")
    @ResponseBody
    public ResponseMessage getStudyGardenList(@RequestBody PageDomain pageDomain) {
        return courseInfoService.getStudyGardenList(pageDomain);
    }

    @PostMapping("/detail")
    @ResponseBody
    public ResponseMessage getStudyGardenItemDetail(@RequestParam String id) {
        return courseInfoService.getStudyGardenItemDetail(id);
    }

    @PostMapping("/update")
    @ResponseBody
    public ResponseMessage studyUpdate(@RequestBody CourseInfoDto dto) {
        return courseInfoService.courseUpdate(dto);
    }

    @PostMapping("/add")
    @ResponseBody
    public ResponseMessage studyAdd(@RequestBody CourseInfoDto dto) {
        return courseInfoService.courseAdd(dto);
    }

    @PostMapping("/delete")
    @ResponseBody
    public ResponseMessage studyDelete(@RequestParam String id) {
        return courseInfoService.courseDelete(id);
    }
}
